package com.amose.factory;

import com.amose.config.Configuration;
import com.amose.handler.SqlMapConfigHandler;
import org.dom4j.DocumentException;

import javax.naming.NamingException;
import java.beans.PropertyVetoException;
import java.io.InputStream;

/**
 * @author yangpeng
 * @time 2020/2/22
 * @since 1.0.0
 * 构建SqlSessionFactory
 */
public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(InputStream in) throws Exception {
        //利用dom4j 解析 sqlMapConfig.xml
        Configuration configuration = new SqlMapConfigHandler().parse(in);
        return new DefaultSqlSessionFactory(configuration);
    }
}
